package com.mls.guardian.appst.chain;

import java.util.*;

/**
 * Created by jl on 15/9/18.
 */
public class Excutors extends   AbstractList<TaskExecutor> {
    private List<TaskExecutor> list = new ArrayList<TaskExecutor>();
    private volatile int index;
    @Override
    public boolean add(TaskExecutor shellExecutor){
        list.add(shellExecutor);

        return true;
    }

    public TaskExecutor next(){
        if(list.size() > index){
            return list.get(index++);
        }

        return null;
    }

    @Override
    public TaskExecutor get(int index) {
        return null;
    }

    @Override
    public int size() {
        return list.size();
    }
}
